package in.bibek.spring.controller;

import in.bibek.dao.UserDao;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * This is the controller for forum Moderator Admin
 * @author BFM
 */

@Controller
public class FMAdminController {

	private UserDao userDao;
	SessionFactory sessionFactory;
	
   public FMAdminController() {
       this.sessionFactory = new Configuration().configure("config/hbm-config.xml").buildSessionFactory();
       this.userDao = new UserDao(this.sessionFactory);
}
	
  @RequestMapping("/dashboard")	  
  public String  showDashbord(Model model)
  {
	  System.out.println("Controller Called !");
	 return "/fmadmin/fmdashboard";
  }
  
  @RequestMapping("/listUser")
  public String listUser(Model model)
  {
	  model.addAttribute("userList", userDao.getAllForumUsers());
	  return "/fmadmin/listUser";
  }
  
}
